Fix Icon mappings for Mapsource. From ian at mahuron.org.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 21 May 2003 02:18:07 +0000 (02:18 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 21 May 2003 02:18:07 +0000 (02:18 +0000)
gpsbabel/mapsource.c

index 8abc20809ab0dd233fc82852d995bcd05263d64f..b9f889258bca58f639e7431e84e6cd9c4b32caf5 100644 (file)
@@ -52,287 +52,148 @@ typedef struct icon_mapping {
        const char *icon;
 } icon_mapping_t;
 
-/*
- * This list is meant for Mapsource version 4.07 and newer and is derived
- * from the list at http://home.online.no/~sigurdhu/MapSource-text.htm .
- * Someone more motivated than myself is encouraged to type the rest of
- * these in.
- */
 static icon_mapping_t icon_table[] = {
-       { 0, "Anchor" },
-       { 0, "Marina" },
-       { 1, "Bell" },
-       { 2, "Green Diamond" },
-       { 3, "Red Diamond" },
-       { 4, "Diver Down Flag 1" },
-       { 5, "Diver Down Flag 2" },
-       { 6, "Bank" },
-       { 6, "ATM" },
-       { 7, "Fishing Area" },
-       { 8, "Gas Station" },
-       { 9, "Horn" },
-       { 10, "Residence" },
-       { 11, "Restaurant" },
-       { 12, "Light" },
-       { 13, "Bar" },
-       { 14, "Skull and Crossbones" },
-       { 15, "Green Square" },
-       { 16, "Red Square" },
-       { 17, "White buoy" },
-       { 18, "Waypoint" },
-       { 19, "Shipwreck" },
-       { 21, "Man Overboard" },
-       { 22, "Navaid Amber" },
-       { 23, "Navaid Black" },
-       { 24, "Navaid Blue" },
-       { 25, "Navaid Green" },
-       { 26, "Navaid Green/Red" },
-       { 27, "Navaid Green/White" },
-       { 28, "Navaid Orange" },
-       { 29, "Navaid Red" },
-       { 30, "Navaid Red/Green" },
-       { 31, "Navaid Red/White" },
-       { 32, "Navaid Violet" },
-       { 33, "Navaid White" },
-       { 34, "Navaid White/Green" },
-       { 35, "Navaid White/Red" },
-       { 36, "White Dot" },
-       { 37, "Radio Beacon" },
-       { 150, "Boat Ramp" },
-       { 151, "Campground" },
-       { 151, "Camping" },
-       { 152, "Restrooms" },
-       { 153, "Showers" },
-       { 154, "Drinking Water" },
-       { 155, "Telephone" },
-       { 156, "Medical Facility" },
-       { 157, "Information" },
-       { 158, "Parking Area" },
-       { 159, "Park" },
-       { 160, "Picnic Area" },
-       { 161, "Scenic Area" },
-       { 162, "Skiing Area" },
-       { 163, "Swimming Area" },
-       { 164, "Dam" },
-       { 165, "Controlled Area" },
-       { 166, "Danger Area" },
-       { 167, "Restricted Area" },
-       { 169, "Ball Park" },
-       { 170, "Car" },
-       { 171, "Hunting Area" },
-       { 172, "Shopping Center" },
-       { 173, "Lodging" },
-       { 174, "Mine" },
-       { 175, "Trail Head" },
-       { 176, "Truck Stop" },
-       { 177, "Exit" },
-       { 178, "Flag" },
-       { 179, "Circle with x" },
-       { 8195, "Mile Marker" },
-       { 8196, "TracBack Point" },
-       { 8197, "Golf Course" },
-       { 8198, "City (Small)" },
-       { 8199, "City (Medium)" },
-       { 8200, "City (Large)" },
-       { 8203, "City (Capitol)" },
-       { 8204, "Amusement Park" },
-       { 8205, "Bowling" },
-       { 8206, "Car Rental" },
-       { 8207, "Car Repair" },
-       { 8208, "Fast Food" },
-       { 8209, "Fitness Center" },
-       { 8210, "Movie Theater" },
-       { 8211, "Museum" },
-       { 8212, "Pharmacy" },
-       { 8213, "Pizza" },
-       { 8214, "Post Office" },
-       { 8215, "RV Park" },
-       { 8216, "School" },
-       { 8217, "Stadium" },
-       { 8218, "Department Store" },
-       { 8219, "Zoo" },
-       { 8220, "Convenience Store" },
-       { 8221, "Live Theater" },
-       { 8226, "Scales" },
-       { 8227, "Toll Booth" },
-       { 8233, "Bridge" },
-       { 8234, "Building" },
-       { 8235, "Cemetery" },
-       { 8236, "Church" },
-       { 8237, "Civil" },
-       { 8238, "Crossing" },
-       { 8239, "Ghost Town" },
-       { 8240, "Levee" },
-       { 8241, "Military" },
-       { 8242, "Oil Field" },
-       { 8243, "Tunnel" },
-       { 8244, "Beach" },
-       { 8245, "Forest" },
-       { 8246, "Summit" },
-       { 8255, "Geocache" },
-       { 8256, "Geocache Found" },
-       { 8257, "Contact Smiley" },
-       { 8258, "Contact Ball Cap" },
-       { 8259, "Contact Big Ears" },
-       { 8260, "Contact Spike" },
-       { 8261, "Contact Goatee" },
-       { 8262, "Contact Afro" },
-       { 8263, "Contact Dreadlocks" },
-       { 8264, "Contact Female 1" },
-       { 8265, "Contact Female 2" },
-       { 8266, "Contact Female 3" },
-       { 8267, "Contact Ranger" },
-       { 8268, "Contact Kung-Fu" },
-       { 8269, "Contact Sumo" },
-       { 8270, "Contact Pirate" },
-       { 8271, "Contact Biker" },
-       { 8272, "Contact Alien" },
-       { 8273, "Contact Bug" },
-       { 8274, "Contact Cat" },
-       { 8275, "Contact Dog" },
-       { 8276, "Contact Pig" },
-       { 16384, "Airport" },
-       { 16388, "Heliport" },
-       { 16389, "Private Field" },
-       { 16390, "Soft Field" },
-       { 16391, "Tall Tower" },
-       { 16392, "Short Tower" },
-       { 16393, "Glider Area" },
-       { 16394, "Ultralight Area" },
-       { 16395, "Parachute Area" },
-       { 16402, "Seaplane Base" },
-
-#if SOMEONE_ELSE
-/* FIXME: Find icons for these */
-       { 1, "Virtual cache"},
-       { 2, "Micro-Cache"},
-       { 3, "Multi-Cache"},
-#endif 
+       {   107, "Airport" },
+       {    73, "Amusement Park" },
+       {    55, "Ball Park" },
+       {     6, "Bank" },
+       {    13, "Bar" },
+       {   104, "Beach" },
+       {     1, "Bell" },
+       {    37, "Boat Ramp" },
+       {    74, "Bowling" },
+       {    93, "Bridge" },
+       {    94, "Building" },
+       {    38, "Campground" },
+       {    56, "Car" },
+       {    75, "Car Rental" },
+       {    76, "Car Repair" },
+       {    95, "Cemetery" },
+       {    96, "Church" },
+       {    65, "Circle with X" },
+       {    72, "City (Capitol)" },
+       {    71, "City (Large)" },
+       {    70, "City (Medium)" },
+       {    69, "City (Small)" },
+       {    97, "Civil" },
+       {   119, "Contact, Afro" },
+       {   120, "Contact, Alien" },
+       {   121, "Contact, Ball Cap" },
+       {   122, "Contact, Big Ears" },
+       {   123, "Contact, Biker" },
+       {   124, "Contact, Bug" },
+       {   125, "Contact, Cat" },
+       {   126, "Contact, Dog" },
+       {   127, "Contact, Dreadlocks" },
+       {   128, "Contact, Female1" },
+       {   129, "Contact, Female2" },
+       {   130, "Contact, Female3" },
+       {   131, "Contact, Goatee" },
+       {   132, "Contact, Kung-Fu" },
+       {   133, "Contact, Pig" },
+       {   134, "Contact, Pirate" },
+       {   135, "Contact, Ranger" },
+       {   136, "Contact, Smiley" },
+       {   137, "Contact, Spike" },
+       {   138, "Contact, Sumo" },
+       {    52, "Controlled Area" },
+       {    89, "Convenience Store" },
+       {    98, "Crossing" },
+       {    51, "Dam" },
+       {    53, "Danger Area" },
+       {    87, "Department Store" },
+       {     4, "Diver Down Flag 1" },
+       {     5, "Diver Down Flag 2" },
+       {    41, "Drinking Water" },
+       {    63, "Exit" },
+       {    77, "Fast Food" },
+       {     7, "Fishing Area" },
+       {    78, "Fitness Center" },
+       {    64, "Flag" },
+       {   105, "Forest" },
+       {     8, "Gas Station" },
+       {   117, "Geocache" },
+       {   118, "Geocache Found" },
+       {    99, "Ghost Town" },
+       {   113, "Glider Area" },
+       {    68, "Golf Course" },
+       {     2, "Green Diamond" },
+       {    15, "Green Square" },
+       {   108, "Heliport" },
+       {     9, "Horn" },
+       {    57, "Hunting Area" },
+       {    44, "Information" },
+       {   100, "Levee" },
+       {    12, "Light" },
+       {    90, "Live Theater" },
+       {    59, "Lodging" },
+       {    20, "Man Overboard" },
+       {     0, "Marina" },
+       {    43, "Medical Facility" },
+       {    66, "Mile Marker" },
+       {   101, "Military" },
+       {    60, "Mine" },
+       {    79, "Movie Theater" },
+       {    80, "Museum" },
+       {    21, "Navaid, Amber" },
+       {    22, "Navaid, Black" },
+       {    23, "Navaid, Blue" },
+       {    24, "Navaid, Green" },
+       {    25, "Navaid, Green/Red" },
+       {    26, "Navaid, Green/White" },
+       {    27, "Navaid, Orange" },
+       {    28, "Navaid, Red" },
+       {    29, "Navaid, Red/Green" },
+       {    30, "Navaid, Red/White" },
+       {    31, "Navaid, Violet" },
+       {    32, "Navaid, White" },
+       {    33, "Navaid, White/Green" },
+       {    34, "Navaid, White/Red" },
+       {   102, "Oil Field" },
+       {   115, "Parachute Area" },
+       {    46, "Park" },
+       {    45, "Parking Area" },
+       {    81, "Pharmacy" },
+       {    47, "Picnic Area" },
+       {    82, "Pizza" },
+       {    83, "Post Office" },
+       {   109, "Private Field" },
+       {    36, "Radio Beacon" },
+       {     3, "Red Diamond" },
+       {    16, "Red Square" },
+       {    10, "Residence" },
+       {    11, "Restaurant" },
+       {    54, "Restricted Area" },
+       {    39, "Restroom" },
+       {    84, "RV Park" },
+       {    91, "Scales" },
+       {    48, "Scenic Area" },
+       {    85, "School" },
+       {   116, "Seaplane Base" },
+       {    19, "Shipwreck" },
+       {    58, "Shopping Center" },
+       {   112, "Short Tower" },
+       {    40, "Shower" },
+       {    49, "Skiing Area" },
+       {    14, "Skull and Crossbones" },
+       {   110, "Soft Field" },
+       {    86, "Stadium" },
+       {   106, "Summit" },
+       {    50, "Swimming Area" },
+       {   111, "Tall Tower" },
+       {    42, "Telephone" },
+       {    92, "Toll Booth" },
+       {    67, "TracBack Point" },
+       {    61, "Trail Head" },
+       {    62, "Truck Stop" },
+       {   103, "Tunnel" },
+       {   114, "Ultralight Area" },
+       {    17, "White Buoy" },
+       {    35, "White Dot" },
+       {    88, "Zoo" },
        { -1, NULL },
 };
 
-static icon_mapping_t new_icon_table[] = {
-       { 0, "Anchor" },
-       { 1, "Bell" },
-       { 2, "Green Diamond" },
-       { 3, "Red Diamond" },
-       { 4, "Diver Down Flag 1" },
-       { 5, "Diver Down Flag 2" },
-       { 6, "Bank" },
-       { 7, "Fishing Area" },
-       { 8, "Gas Station" },
-       { 9, "Horn" },
-       { 10, "Residence" },
-       { 11, "Restaurant" },
-       { 12, "Light" },
-       { 13, "Bar" },
-       { 14, "Skull and Crossbones" },
-       { 15, "Green Square" },
-       { 16, "Red Square" },
-       { 17, "White buoy" },
-       { 18, "Waypoint" },
-       { 19, "Shipwreck" },
-       { 20, "Man Overboard" },
-       { 21, "Navaid Amber" },
-       { 22, "Navaid Black" },
-       { 23, "Navaid Blue" },
-       { 24, "Navaid Green" },
-       { 25, "Navaid Green/Red" },
-       { 26, "Navaid Green/White" },
-       { 27, "Navaid Orange" },
-       { 28, "Navaid Red" },
-       { 29, "Navaid Red/Green" },
-       { 30, "Navaid Red/White" },
-       { 31, "Navaid Violet" },
-       { 32, "Navaid White" },
-       { 33, "Navaid White/Green" },
-       { 34, "Navaid White/Red" },
-       { 35, "White Dot" },
-       { 36, "Radio Beacon" },
-       { 37, "Boat Ramp" },
-       { 38, "Campground" },
-       { 39, "Restrooms" },
-       { 40, "Showers" },
-       { 41, "Drinking Water" },
-       { 42, "Telephone" },
-       { 43, "Medical Facility" },
-       { 44, "Information" },
-       { 45, "Parking Area" },
-       { 46, "Park" },
-       { 47, "Picnic Area" },
-       { 48, "Scenic Area" },
-       { 49, "Skiing Area" },
-       { 50, "Swimming Area" },
-       { 51, "Dam" },
-       { 52, "Controlled Area" },
-       { 53, "Danger Area" },
-       { 54, "Restricted Area" },
-       { 55, "Ball Park" },
-       { 56, "Car" },
-       { 57, "Hunting Area" },
-       { 58, "Shopping Center" },
-       { 59, "Lodging" },
-       { 60, "Mine" },
-       { 61, "Trail Head" },
-       { 62, "Truck Stop" },
-       { 63, "Exit" },
-       { 64, "Flag" },
-       { 65, "Circle with x" },
-       { 66, "Mile Marker" },
-       { 67, "TracBack Point" },
-       { 68, "Golf Course" },
-       { 69, "City (Small)" },
-       { 70, "City (Medium)" },
-       { 71, "City (Large)" },
-       { 72, "City (Capitol)" },
-       { 73, "Amusement Park" },
-       { 74, "Bowling" },
-       { 75, "Car Rental" },
-       { 76, "Car Repair" },
-       { 77, "Fast Food" },
-       { 78, "Fitness Center" },
-       { 79, "Movie Theater" },
-       { 80, "Museum" },
-       { 81, "Pharmacy" },
-       { 82, "Pizza" },
-       { 83, "Post Office" },
-       { 84, "RV Park" },
-       { 85, "School" },
-       { 86, "Stadium" },
-       { 87, "Department Store" },
-       { 88, "Zoo" },
-       { 89, "Convenience Store" },
-       { 90, "Live Theater" },
-       { 91, "Scales" },
-       { 92, "Toll Booth" },
-       { 93, "Bridge" },
-       { 94, "Building" },
-       { 95, "Cemetery" },
-       { 96, "Church" },
-       { 97, "Civil" },
-       { 98, "Crossing" },
-       { 99, "Ghost Town" },
-       { 100, "Levee" },
-       { 101, "Military" },
-       { 102, "Oil Field" },
-       { 103, "Tunnel" },
-       { 104, "Beach" },
-       { 105, "Forest" },
-       { 106, "Summit" },
-       { 107, "Airport" },
-       { 108, "Heliport" },
-       { 109, "Private Field" },
-       { 110, "Soft Field" },
-       { 111, "Tall Tower" },
-       { 112, "Short Tower" },
-       { 113, "Glider Area" },
-       { 114, "Ultralight Area" },
-       { 115, "Parachute Area" },
-       { 116, "Seaplane Base" },
-       { 117, "Geocache" },
-       { 118, "Geocache Found" },
-};
-
 char *snlen;
 
 static
@@ -360,7 +221,7 @@ mps_find_icon_number_from_desc(const char *desc)
        icon_mapping_t *i;
        int def_icon = 18;
 
-       if (!desc) 
+       if (!desc)
                return def_icon;
 
        for (i = icon_table; i->icon; i++) {
@@ -432,10 +293,14 @@ mps_read(void)
        waypoint *wpt;
 
        fread(hdr, 45, 1, mps_file_in);
+#ifdef DUMP_ICON_TABLE
+       printf("static icon_mapping_t icon_table[] = {\n");
+#endif
+
        for(;;)
        {
                long next_rec;
-               char icon;
+               unsigned short int icon;
                fread(&reclen, 4, 1, mps_file_in);
                reclen = le_read32(&reclen);
                fread(tbuf, 1, 1, mps_file_in); /* 'W' */
@@ -475,8 +340,15 @@ mps_read(void)
                wpt->position.longitude.degrees = lon / 2147483648.0 * 180.0;
                wpt->icon_descr = mps_find_desc_from_icon_number(icon);
                waypt_add(wpt);
-       }
 
+#ifdef DUMP_ICON_TABLE
+               printf("\t{  %4u, \"%s\" },\n", icon, wpt->shortname);
+#endif
+       }
+#ifdef DUMP_ICON_TABLE
+               printf("\t{ -1, NULL },\n");
+               printf("};\n");
+#endif
 }
 
 static void